<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
		<title>角色管理</title>
		[#include "/html/include/easyuicss.html" /]
		[#include "/html/include/easyuijs.html" /]
	</head>
	<body class="easyui-layout" data-options="fit:true">

		<form id="roleForm" class="easyui-form" method="post" data-options="novalidate:true">
			<input type="hidden" name="method" value="${RequestParameters['method']}" />
			<input type="hidden" name="roleId" value="${role.role_id}" />
			<table class="tblEidt">
				<tr>
					<td class="tdText">
						角色名称<label style="color:red;">*</label>：
					</td>
					<td class="tdInput">
						<input class="easyui-textbox" name="roleName" value="${role.role_name}" data-options="required:true,validateOnCreate:false" validType="remote['${app}/sysmgr/role/checkRoleName.do?roleId=${role.role_id}','roleName']" invalidMessage="角色名称已存在" />
					</td>
					<td class="tdText">
						角色顺序<label style="color:red;">*</label>：
					</td>
					<td class="tdInput">
						<input class="easyui-textbox" name="showOrder" value="${role.show_order}" data-options="required:true" validType="Number['请填写数字']" />
					</td>
				</tr>
			</table>
			<div class="edit-btn-group">
				<a href="javascript:;" class="easyui-linkbutton"
				   data-options="iconCls:'icon-ok'" style="width:80px"
				   onclick="saveRole(this);">保存</a>
				&nbsp;&nbsp;
				<a href="javascript:;" class="easyui-linkbutton"
				   data-options="iconCls:'icon-cancel'" style="width:80px"
				   onclick="closeWindow();">关闭</a>
			</div>
		</form>
	</body>
    <script type="text/javascript">
		var index = parent.layer.getFrameIndex(window.name);
		function closeWindow(){
			parent.layer.close(index);
		}
		function saveRole(obj){
			$(obj).linkbutton('disable');
			$('#roleForm').form('submit', {
				url: '${app}/sysmgr/role/save.do',
				onSubmit: function () {
					var valid = $(this).form('enableValidation').form('validate');
					if (!valid) {
						$(obj).linkbutton('enable');
					}
					return valid;
				},
				success: function (data) {
					var result = $.parseJSON(data);
					parent.easyui.msgShow('系统提醒', result.msg, 3000, 250, 100);
					$(obj).linkbutton('enable');
					if (result.result == 1) {
						parent.layer.close(index);
						parent.frames[parent.iframeName].window.reloadRoles();
					}
				}
			});
		}
    </script>
</html>